#include #include using namespace std; //function - aka - method, routine, subroutine //like paragraphs in writing //reasons to use functions //code easer to understand because it is one unit of work //encapsulation - black-box - //code reuseable //functions that do not give, "return", are void functions //two types of functions - void and non-void void sayHi() { cout << "Hi" << endl; } //n is a parameter void sayHiNTimes(int n) { int i = 0; while(i < n) { cout << "Hi" << endl; i++; } } int myFavoriteNumber() { int result = 15; //logic goes here return result; } double greater(double i, double j) { double result = i; if(j > i) { result = j; } return result; } int power(int x, int y) { int result = 1; while(y > 0) { result = result * x; y--; } return result; } void main() { double x; double y; cin >> x; cin >> y; cout.precision(3); cout.setf(ios_base::fixed); cout << pow(x,y) << endl; cout << power(x,y) << endl; sayHi(); //calls sayHi function sayHi(); //calls sayHi function sayHi(); //calls sayHi function sayHi(); //calls sayHi function //7 is an argument to the paramter n sayHiNTimes(7); cout << myFavoriteNumber() << endl; cout << greater(x,y) << endl; }